package com.wangjw.springbootdemo.controller;

import com.wangjw.springbootdemo.pojo.IMoocJSONResult;
import com.wangjw.springbootdemo.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * Created by wangjw on 18/5/29.
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/getUser")
    public User getUser() {
        User user = new User();
        user.setName("wangjw");
        user.setAge(31);
        user.setBirthday(new Date());
        user.setPassword("123456");
        user.setDesc("hello wangjw~~~");
        return user;
    }

    @RequestMapping("/getUserJson")
    public IMoocJSONResult getUserJson() {
        User user = new User();
        user.setName("nijj");
        user.setAge(30);
        user.setBirthday(new Date());
        user.setPassword("123456");
        user.setDesc("hello nijj~~~");
        return IMoocJSONResult.ok(user);
    }
}
